import { axios } from '@/utils/request'

/**
 * 分页查询股票数据
 * @param params
 * {
 *   pageNo : 1
 *   pageSize : 10
 *   id : "1"
 *   name : "2"
 *   code : "3"
 *   module : "hszb"
 *   show : "false"
 * }
 * @returns {AxiosPromise}
 */
export function stockPage (params) {
  console.log('stockPage.params', params)
  return axios({
    url: '/stock/page',
    method: 'get',
    params: params
  })
}

/**
 * 查询股票详情
 * @param params
 * {
 *   id : "1"
 * }
 * @returns {AxiosPromise}
 */
export function stockInfo (params) {
  console.log('stockInfo.param', params)
  return axios({
    url: '/stock/' + params.id,
    method: 'get'
  })
}

export function addStock (params) {
  console.log('addStock.params', params)
  return axios({
    url: '/stock/add',
    method: 'post',
    data: params
  })
}

export function updateStock (params) {
  console.log('updataStock.params', params)
  return axios({
    url: '/stock/' + params.id,
    method: 'put',
    data: params
  })
}

export function deleteStock (params) {
  console.log('deleteStock.params', params)
  return axios({
    url: '/stock/' + params.id,
    method: 'delete'
  })
}
